$(function () {
    window.onload = function () {
        $.ajax({
            url:'http://localhost:3000/report/new',
            method: 'get',
            success: function (res) {
                var sdd = [];
                var str = '';
                for (var i = 0; i < 8; i++) {
                    sdd.push(res[i])
                }
                $.each(sdd, function (index, item) {
                    // console.log(item);
                    str += "<li class=report>" +
                        "<img src=" + item.img + ">" +
                        "<div class=wen>" + item.text + "</div>" +
                        "<div class=comment>苏苏" +
                        "<span>" + "<img src=../img/css-img/img/xin.png>3&nbsp;&nbsp;" + "<img src=../img/css-img/img/zan.png>&nbsp;&nbsp;3" + "</span>" +
                        "</div>" +
                        "</li>";
                })
                $('.content-box2').html(str);
            }
        })
        $.ajax({
            url: 'http://localhost:3000/guid/new',
            method: 'get',
            success: function (reb) {
                var add = [];
                var str = '';
                for (var i = 0; i < 4; i++) {
                    add.push(reb[i])
                }
                $.each(add, function (index, item) {
                    str += "<li class=report>" +
                        "<img src=" + item.img + ">" +
                        "<div class=wen>" + item.text + "</div>" +
                        "<div class=comment>" +
                        "<span>" + "<img src=../img/css-img/img/xin.png>3&nbsp;&nbsp;" + "<img src=../img/css-img/img/zan.png>&nbsp;&nbsp;3" + "</span>" +
                        "</div>" +
                        "</li>"
                })
                $('.content-box3').html(str);
            }
        })
        $.ajax({
            url: 'http://localhost:3000/play/hot',
            method: 'get',
            success: function (rey) {
                // console.log(rey);
                var sdd = [];
                var str = '';
                for (var i = 0; i < 24; i++) {
                    sdd.push(rey[i]);
                }
                $.each(sdd, function (index, item) {
                    console.log(item);
                    $.each(item,function(a, item1){
                        str += "<li class=report>" +
                    "<img src=" + item1.img + ">" +
                        "<div class=wen>" + item1.text + "</div>" +
                        "<div class=comment>"+item1.price +
                        "<span color=red>" + "<img src=../img/css-img/img/xin.png>3&nbsp;&nbsp;" + "<img src=../img/css-img/img/zan.png>&nbsp;&nbsp;3" + "</span>" +
                        "</div>" +
                        "</li>"
                    })  
                })
                $('.content-box4').html(str);
            }
        })
        $('.content-box5').click(function(){
            $('.content-box').css('height','2420px');
            $('.content-box4').css('height','1380px');
            $('.content-box5').hide();
        })
    }
})